package api.cherry.feign.fallback;

import api.cherry.feign.CrApiLoginService;
import api.cherry.feign.CrApiHomepageService;
import cherry.data.util.Result;
import cherry.data.view.request.CherryHomePageRequest;
import cherry.data.view.request.CherryRequest;
import cherry.data.view.response.CherryHomePageResponse;
import com.github.pagehelper.PageInfo;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author 谢宇翔
 * @version 1.0.0
 * @ClassName CrApiErrorLoginServiceImpl.java
 * @Description 远程调用异常处理
 * @createTime 2022年02月07日 16:48:00
 */
@Slf4j
@Component
public class CrApiApiErrorLoginServiceImpl implements CrApiLoginService, CrApiHomepageService {
    @Setter
    private Throwable t;

    @Override
    public Result<?> logIns(CherryRequest request) {
        log.error("登录接口异常" + t);
        log.info("登录接口异常，报错内容：" + request);
        return new Result<>(901, t);
    }

    @Override
    public Result<?> register(CherryRequest request) {
        log.info("注册失败" + t);
        log.info("注册失败，报错内容：" + request);
        return new Result<>(901, t);
    }

    /**
     * @param request
     * @ClassName CrHomepageService.java
     * @author 谢宇翔
     * @version 1.0.0
     * @Description 分页查询
     * @createTime 2022年02月07日 16:53:00
     */
    @Override
    public Result<PageInfo<CherryHomePageResponse>> findPage(CherryHomePageRequest request) {
        log.info("分页查询报错信息：" + t);
        log.info("分页查询报错信息，报错内容：" + request);
        return new Result<>(901);
    }
}
